﻿namespace EyeOpen.TimeAssistant.Service
{
    using EyeOpen.TimeAssistant.Domain;
    using EyeOpen.Validation;
    using EyeOpen.Validation.Mapping;

    public class UserStoryValidator : EntityValidator<UserStory>
    {
        protected override void ValidateEntity(UserStory entity)
        {
            ClearValidationResults();

            if (entity.Priority >= 1)
            {
                return;
            }

            var validationResult = 
                new ValidationResult
                    {
                        PropertyName = "Priority"
                    };

            validationResult.ValidationMessages.Add("Priority must be greater than 0.");

            AddValidationResult(validationResult);
        }
    }
}